﻿// If you define HAS_VIEWED_ANNOTATIONS, the workbench will:
// 1) Record annotations as they are viewed;
// 2) Display web content in an internal web browser, rather than spawning windows of the user's preferred browser;
// 3) Add an item to the left-hand tree in the main window allowing the user to view a coverflow of the recorded annotation sessions
#define HAS_VIEWED_ANNOTATIONS

using System;
using Microsoft.Practices.Unity;

using SharedGenomics.Core.Configuration;
using SharedGenomics.Workbench.Core.Configuration;

namespace ROWorkbench
{
    public static class IoCContainer
    {
        private static readonly IUnityContainer _container = CreateContainer();

        public static IUnityContainer Instance
        {
            get { return _container; }
        }

        private static IUnityContainer CreateContainer()
        {
            //create a new config chain and register all required strategies required to configure the container
            ContainerConfigurationStrategyChain configChain = new ContainerConfigurationStrategyChain();
            configChain.AddStrategy<SettingsDependentsContainerConfigurationStrategy>();
            configChain.AddStrategy<CoreContainerConfigurationStrategy>();
            configChain.AddStrategy<FrameworkContainerConfigurationStrategy>();
            configChain.AddStrategy<WindowsFormsViewContainerConfigurationStrategy>();
            configChain.AddStrategy<ApplicationContainerConfigurationStrategy>();
            configChain.AddStrategy<PresenterContainerConfigurationStrategy>();
            configChain.AddStrategy<ServicesContainerConfigurationStrategy>();
            configChain.AddStrategy<AnnotationContainerConfigurationStrategy>();

            var configFactory = new AppConfigurationReaderFactory();
            var configReader = configFactory.GetConfigurationReader();

            return configChain.CreateContainer(configReader);
        }
    }
}
